﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace eeenno.SpeeedReaderUI.Forms
{
    class Browser
    {
        private IntPtr _form_ptr;
        private int _hWnd;
        public const int WS_CHILD = 0x40000000;
        public const int WS_VISIBLE = 0x10000000;
        public const int WS_BORDER = 0x800000;

        [DllImport("coredll.dll")]
        public static extern IntPtr CreateWindowEx(
        uint dwExStyle, string lpClassName, string lpWindowName,
        uint dwStyle, int x, int y, int width, int height, IntPtr hWndParent,
        int hMenu, IntPtr hInstance, string lpParam);

        [DllImport("coredll.dll", EntryPoint = "SendMessage")]
        public static extern int SendMessageStr(
        IntPtr hWnd,
        int message,
        int data,
        string s);

        [DllImport("coredll.dll")]
        public static extern int LoadLibrary(string LibraryName);

        public Browser(IntPtr form_ptr)
        {
            _form_ptr = form_ptr;                       
        }

       

        public IntPtr CreateBrowser()
        {
            IntPtr browser = CreateWindowEx(0, "DISPLAYCLASS", "", WS_CHILD | WS_VISIBLE | WS_BORDER, 
                0, 0, 300, 300, _form_ptr, 0, IntPtr.Zero, null);

            return browser;
        }
    }
}
